package com.yang.concurrency.chapter2;

/**
 * @Author: 血魔
 * @Date: Created in 12:52 2021/12/12
 * @Version: 1.0$
 */
public class BankTwo {
    public static void main(String[] args) {
//        final TicketWindowRunnable tw = new TicketWindowRunnable();
        final Runnable ticketWindow = () -> {
            int i = 0;
            while (i <= 50) {
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("当前线程名称：" + Thread.currentThread().getName() + "这是第几张票" + (i++));
            }

        };
        Thread wt1 = new Thread(ticketWindow, "杨兴卓");
        Thread wt2 = new Thread(ticketWindow, "陈瑾玉");
        Thread wt3 = new Thread(ticketWindow, "我自己");
        wt1.start();
        wt2.start();
        wt3.start();
    }
}
